import os
from datetime import datetime


class ProjectPath:
    # 创建日志路径
    root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    log_path = os.path.join(root_path, 'LOG', 'log_dir')
    filename = os.path.join(log_path, f'{datetime.now().strftime("%Y%m%d")}.log')
    image_dir = os.path.join(root_path, 'Image', f'{datetime.now().strftime("%Y%m%d")}')
    image_path = os.path.join(image_dir, f'error{datetime.now().strftime("%Y%m%d%H%M%S")}.jpg')
    record_path = os.path.join(root_path, "record", f'{datetime.now().strftime("%Y%m%d")}')

    if not os.path.exists(image_dir):
        os.mkdir(image_dir)

    if not os.path.exists(record_path):
        os.mkdir(record_path)

path = ProjectPath()
